<?php

namespace App\Http\Requests\Article;

use App\Http\Requests\AbstractApiRequest;
use Dingo\Api\Http\FormRequest;
use Illuminate\Validation\ValidationException;

class Store extends AbstractApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

     /**
      * Get the validation rules that apply to the request.
      *
      * @return array
      */
     public function rules()
     {
         return [
            'title' => 'required',
            'content' => 'required',
            'folder_id' => 'required|numeric'
         ];
     }

     /**
      * 获取已定义验证规则的错误消息。
      *
      * @return array
      */
     public function messages()
     {
        return [
            'title.required' => '标题不能为空',
            'content.required' => '内容不能为空',
            'folder_id.required' => '文章所在目录不能为空',
            'folder_id.numeric' => '目录id错误'
         ];
     }
}
